<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
    <head th:include="include :: header"></head>
    <body class="hold-transition skin-blue sidebar-mini">
        <section class="content-header">
            <h1>完成时间查询</h1>
        </section>
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <form id="queryForm">
                                <div class="row">
                                    <div class="form-inline">
                                        <div class="form-group" style="margin-right: 10px;">
                                            <label>名称</label>
                                            <input type="text" name="name" class="form-control" placeholder="请输入项目名称或订单号或代码">
                                        </div>
                                        <div class="form-group" style="margin-right: 10px;">
                                            <label>类型</label>
                                            <select name="taskType" class="form-control" >
                                                <option value="1">项目</option>
                                                <option value="2">工艺</option>
                                                <option value="3">生产</option>
                                                <option value="4">平库</option>
                                                <option value="5">喷涂</option>
                                                <option value="6">包装</option>
                                                <option value="7">仓储</option>
                                            </select>
                                        </div>
                                        <div class="form-group" style="margin-right: 10px;">
                                            <label>完成年度</label>
                                            <select id="year" name="year" class="form-control" >
                                                <option value="" selected="selected">请选择</option>
                                            </select>
                                        </div>

                                        <div class="form-group" style="margin-right: 10px;">
                                            <label>排序</label>
                                            <select name="orderType" class="form-control" >
                                                <option value="1">正序</option>
                                                <option value="2">倒序</option>
                                            </select>
                                        </div>
                                        <button type="button" class="btn btn-success" id="btn-search">
                                            <!--<i class="fa fa-search"></i>-->
                                            <span class="Bold">搜索</span>
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="box-body">
                            <div class="table-responsive">
                                <table id="bootstrap-table"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <div th:include="include :: footer"></div>
        <script th:inline="javascript">

            /** 初始化日期选择下拉列表 */
            function yearSelectCreate() {
                var date= new Date();
                var endYear = date.getFullYear();
                for (var i = endYear; i >= 2016; i--) {
                    if (i === 2016)
                        $("#year").append("<option value='" + i + "'>" + i + "年及以前" + "</option>");
                    else
                        $("#year").append("<option value='" + i + "'>" + i + "年" + "</option>");
                }
            }

            $(function () {

                yearSelectCreate();

                /** 加载列表 */
                table = js.table.init({
                    url: ctx + "integrate/schedule/list",
                    showColumns: true,
                    showExport: true,
                    columns: [
                        {
                            title: '序号', field: 'id', width: '40',
                            formatter: function (value, row, index, field) {
                                return index + 1;
                            }
                        },
                        {title: '项目名称', field: 'name', width: '180'},
                        // {title: '客户', field: 'client'},
                        {title: '订单号', field: 'orderNum', width: '60'},
                        // {title: '代码', field: 'code', width: '80'},
                        // {title: '数量', field: 'num'},
                        /*{title: '生产厂', field: 'factories', width: '80',
                            formatter: function (value, row, index) {
                                if (value != null) {
                                    return value.split(',').join('<br>');
                                }
                            }
                        }, */
                        // {title: '备注', field: 'remark', width: '200'},
                        {title: '客户要求<br>发货时间', field: 'shipTime', width: '100'},
                        {title: '设计文件<br>下发时间', field: 'designTime', width: '100'},
                        {title: '项目下达<br>任务时间', field: 'sendTime', width: '100'},
                        {title: '工艺编制<br>完成时间', field: 'processCompleteTime', width: '100'},
                        {title: '生产焊接<br>完成时间', field: 'produceCompleteTime', width: '100'},
                        {title: '平库<br>完成时间', field: 'consumeCompleteTime', width: '100'},
                        {title: '喷涂<br>完成时间', field: 'sprayCompleteTime', width: '100'},
                        {title: '包装<br>完成时间', field: 'packCompleteTime', width: '100'},
                        {title: '仓储<br>完成时间', field: 'storeCompleteTime', width: '100'},
                        {title: '首次<br>发货时间', field: 'firstShipTime', width: '100'},
                        {title: '最后<br>发货时间', field: 'lastShipTime', width: '100'},
                        {title: '项目<br>完成时间', field: 'completeTime', width: '100'},
                        {
                            title: '操作', width: '40',
                            formatter: function (value, row, index) {
                                var actions = [];
                                actions.push('<a class="btn btn-xs btn-info" target="_blank" href="'+ ctx + 'board/single/' + row.id + '"> 查看</a> ');
                                return actions.join('');
                            }
                        }
                    ]
                });

                /** 表格搜索 */
                $("#btn-search").click(function () {
                    js.table.search(table);
                });
            });
        </script>
    </body>
</html>
